#!/usr/bin/env tclsh


#1.生成一个list
set l1 [list 1 2 {3 4}]
puts "生成的list:$l1"

#2.连接多个list
set l1 [list 1 2 {3 4}]
set l2 [list 5 6 ]
set l3 [concat $l1 $l2]
puts "$l3"

#3.按索引读list
set l1 [list 1 2 {3 4}]
set ans [lindex $l1 1]
puts "$ans"


#4.获取list元素个数
set l1 [list 1 2 {3 4}]
set ans [llength $l1]
puts "$ans"

#5.插入元素
#linsert list index value value... (0-base)
set l1 [list 1 2 {3 4}]
set ans [linsert $l1 1 10 12]
puts "$ans"

#6.替代\删除元素
#lreplace list first last value value ...
set l1 [list 1 2 {3 4}]
set ans [lreplace $l1 1 2 60 65]
puts "$ans"
 
